package interfaces

import (
	"github.com/edgexfoundry/edgex-go/internal/app/models"
	"github.com/edgexfoundry/go-mod-core-contracts/v2/errors"
)

type DBClient interface {
	/*
		device function
	*/
	DeviceIdExists(id string) (bool, errors.EdgeX)
	DevicesGetByLabels(labels []string, offset, limit int) ([]models.Device, uint32, errors.EdgeX)
	DevicesGetByProduct(productId string, offset, limit int) ([]models.Device, uint32, errors.EdgeX)
	DevicesGetByName(name, productId string, offset, limit int) (devices []models.Device, totalCount uint32, err errors.EdgeX)
	DeviceAdd(device models.Device) (models.Device, errors.EdgeX)
	DeviceGetById(deviceId string) (models.Device, errors.EdgeX)
	DeviceUpdate(device models.Device) errors.EdgeX
	DeviceDelete(deviceIds ...string) ([]models.Device, errors.EdgeX)
	SyncDeviceProfileById(deviceId string) (models.DeviceProfile, errors.EdgeX)
	SyncAutoEventsToDevice(deviceId string) errors.EdgeX
	/*
		device profile
	*/
	DeviceProfileAdd(deviceId string, e models.DeviceProfile) (string, errors.EdgeX)
	DeviceProfileById(id string) (models.DeviceProfile, errors.EdgeX)

	/*
		device resource
	*/
	DeviceResourceAdd(deviceId string, d models.DeviceResource) (string, errors.EdgeX)
	DeviceResourceDelete(deviceId, resourceName string) (string, errors.EdgeX)
	DeviceResourceUpdate(deviceId string, dr models.DeviceResource) (string, errors.EdgeX)
	DeviceResourcesGetByDeviceId(deviceId string, offset, limit int) ([]models.DeviceResource, uint32, errors.EdgeX)

	/*
		device commands
	*/
	DeviceCommandAdd(deviceId string, d models.DeviceCommand) (string, errors.EdgeX)
	DeviceCommandGet(deviceId string, offset, limit int) ([]models.DeviceCommand, uint32, errors.EdgeX)
	DeviceCommandDelete(deviceId, commandCode string) errors.EdgeX
	DeviceCommandUpdate(deviceId string, d models.DeviceCommand) errors.EdgeX

	/*
		device auto event
	*/
	AutoEventAdd(deviceId string, d models.AutoEvent) (string, errors.EdgeX)
	AutoEventGetByDeviceId(deviceId string) ([]models.AutoEvent, errors.EdgeX)
	AutoEventDelete(deviceId, eventId string) errors.EdgeX
	AutoEventUpdate(deviceId string, d models.AutoEvent) errors.EdgeX
	/*
		device transport
	*/
	TransportAdd(deviceId string, d models.Transport) (string, errors.EdgeX)
	TransportGetByDeviceId(deviceId string, offset, limit int) ([]models.Transport, uint32, errors.EdgeX)
	TransportDelete(deviceId, eventId string) errors.EdgeX
	TransportUpdate(deviceId string, d models.Transport) errors.EdgeX

	CountByDeviceStatus(duration int32) (models.DeviceCount, errors.EdgeX)

	/**
	 * @Description 产品分类相关查询DB接口
	 * @auth kely
	 * @Date 2023-2-20
	 **/
	AllproductCategorys(offset int, limit int, labels []string) ([]models.ProductCategory, errors.EdgeX)

	/**
	 * @Description 产品分类名称模糊查询接口
	 * @auth kely
	 * @Date 2023-2-20
	 **/
	ProductCategorysByName(offset int, limit int, labels string) ([]models.ProductCategory, errors.EdgeX)

	/**
	 * @Description 产品分类新增
	 * @auth kely
	 * @Date 2023-2-21
	 **/
	AddProductCategory(d models.ProductCategory) (models.ProductCategory, errors.EdgeX)

	///**
	// * @Description 产品分类-根据id查询
	// * @method
	// * @auth kely
	// * @Date ${DATE}
	// * @Param
	// * @return
	// **/
	//
	//ProductCategoryById(id string) (models.ProductCategory, errors.EdgeX)
}
